package com.yjd.comm.util;

import com.yjd.comm.order.model.OrderNoFactoryModel;
import com.yjd.comm.order.service.IOrderNoFactoryService;
import com.yjd.comm.rpm.RpmServiceKeyEnum;

/**
 * 订单编号工具类
 * Created by yjd-wap on 2017/8/17.
 */
public class OrderNoFactoryUtils {

    /**
     * 生成一个新的订单编号
     * @return
     */
    public static String getOrderNo() throws Exception{
        OrderNoFactoryModel orderNo = new OrderNoFactoryModel();
        orderNo =  getOrderNoFactoryService().insert(orderNo);
        return orderNo.getOrder_no().toString();
    }

    private static IOrderNoFactoryService getOrderNoFactoryService()throws Exception{
        return ServiceHolder.getLocalService(IOrderNoFactoryService.class,"orderNoFactoryService");
    }

}
